;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; HW7 blocks world + painting (stub)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (domain hw6)
  (:requirements :strips)

  (:constants 
	red
	blue
	)
	
  (:predicates 
	(on ?x ?y)
	(on-table ?x)
	(clear ?x)
	(arm-empty)
	(holding ?x)
	(color ?x ?c)
	(clean ?x)
	(paint ?x ?c)
	
  )	 
  
(:action stack
	     :parameters (?sob ?sunderob)
	     :precondition (and (holding ?sob) (clear ?sunderob))
	     :effect
	     (and (not (holding ?sob))
		   (not (clear ?sunderob))
		   (clear ?sob)
		   (arm-empty)
		   (on ?sob ?sunderob)))
		   
(:action unstack
	     :parameters (?blockB ?blockA)
	     :precondition (and (on ?blockB ?blockA) (clear ?blockB) (arm-empty))
	     :effect
	     (and (holding ?blockB)
		   (clear ?blockA)
		   (not (clear ?blockB))
		   (not (arm-empty))
		   (not (on ?blockB ?blockA))))
		   
(:action wash-brush
	     :parameters (?brush ?waterbucket)
	     :precondition ( and (holding ?brush)
						(clear ?waterbucket)
						(color ?brush red)
						(not(clear ?brush))
						(on-table ?waterbucket))
	     :effect
	     (and (clean ?brush)))
						
	 
(:action spray-paint
	     :parameters (?blockB ?sprayer  ?blue )
	     :precondition ( and (holding ?sprayer)
						(on-table ?blockB)
						(color ?sprayer  blue)
						
						;;(not (color ?blockB  blue))
						)
	     :effect
	     (and (color ?blockB  blue)))
		 
(:action load-brush-with-color
	     :parameters (?brush ?can )
	     :precondition ( and (holding ?brush)
						(clean ?brush)
						(on-table ?can)
						(paint ?can red)
						)
	     :effect
	     (and (color ?brush  red)
				(Not(clean ?brush))))
		 
(:action brush-paint
	     :parameters (?brush ?blockA )
	     :precondition ( and (holding ?brush)
						(on-table blockA)
						(clear blockA)
						(color ?brush  red)
						
						(Not(clean ?brush)))
	     :effect
	     (and (color ?blockA  red)))
	   
		   
(:action put-down
	     :parameters (?obj1 )
	     :precondition (and (holding ?obj1) (not(arm-empty)))
	     :effect
	     (and (not (holding ?obj1))
		   (arm-empty)
		   (clear ?obj1)
		   (on-table ?obj1)))

		   
(:action pickup
	     :parameters (?obj)
	     :precondition (and (on-table ?obj)
						(clear ?obj)
						(arm-empty))
	     :effect
	     (and (holding ?obj)
		   (not(arm-empty))
		   (not (clear ?obj))
		   (not(on-table ?obj)))))
		   



